package com.zhang;

import com.zhang.init.StaffingInit;
import com.zhang.pojo.Department;
import com.zhang.service.DepartmentService;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ZhangJunqi
 * @Date 2022/3/1 -22:05
 */
public class MyApplicationListener implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("初始化");
        StaffingInit staffingInit=event.getApplicationContext ().getBean (StaffingInit.class);
        staffingInit.departmentInit ();
    }
}
